import React from 'react';
import { observer } from 'mobx-react';
import loadjs from 'loadjs';
import { MindMapProps } from '.';

@observer
export default class Container extends React.Component<MindMapProps, any> {  


    componentDidMount(){
        const { mindMapStore } = this.props;
        let jsFiles:string[]=['/formmode/e9resource/d3js/d3.v5.min.js'];
        if (!loadjs.isDefined('d3')) {
            loadjs(jsFiles, 'd3', {
                    success: () => {
                        mindMapStore.init();
                    }
                });
        } else {
            mindMapStore.init();
        }
    }

    render() {
        return (
            <div className="cube_mindMap_container">
                <svg id="mindMapContainer"></svg>
            </div>
        )
    }

}